package com.hsteach.enums;

import com.hsteach.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * <p>
 *
 * </p>
 *
 * @author mgb
 * @version DeleteStatusEnum, java v1.0 2023-11-10 1:17 EXP $
 */
@Getter
@AllArgsConstructor
public enum DeleteStatusEnum {
    UN_DELETE(0, "未移除"),
    IS_DELETE(1, "已移除");

    private Integer code;
    private String strCode;

    public static DeleteStatusEnum getInByCode(Integer code){
        DeleteStatusEnum deleteStatusEnum = Arrays.stream(DeleteStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
        if (deleteStatusEnum == null) {
            throw new ServiceException("不存在的状态值");
        }
        return deleteStatusEnum;
    }


}
